<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      //   1. 模板字符串
      var str = "fdafdsa";
      var name = "张三";
      // ${}-->插值表达式  ：可以接收简单的逻辑 运算 和三目运算符；
      // let str = `fdsa${name}fdasf`;
      // let str = `fdafd${1+4}afdas`;
      let str = `fdafd${true ? "hello" : "world"}afdas`;
      console.log(str);

      // 2.展开运算符 ；
      let arr = ["张三", "李四", "王五"];
      let arr2 = ["王小六", "王健林", ...arr];
      console.log(arr2);
      // concat

      let obj = { name: "张三", age: 20 };
      let obj2 = { height: "178cm", ...obj };
      console.log(obj2);

      // 把伪数组转成数组；
      function fn() {
        console.log(arguments);
        var arr = [...arguments];
        console.log(arr);
      }

      fn(1, 2, 3);

      // 接收不定参；
      function fn(...arr) {
        console.log(arr);
      }
      fn(1, 2, 3, 4, 5);
      var arr = [1, 5, 2, 3, 6];
      console.log(Math.max(...arr));
    </script>
  </body>
</html>
